Token   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 10
dl 0
loc 22
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A toString 0 6 1
1 4
export const enum TokenType {
2 4
  identifier,
3 4
  keyword,
4 4
  separator,
5 4
  operator,
6 4
  literal,
7 4
  comment,
8
}
9
10
/**
11
 * @class Token
12
 * @name Token
13
 */
14 4
export class Token {
15
  type: TokenType
16
  s: string
17
18
  /**
19
   * Initialize a token.
20
   */
21
  constructor(type: TokenType, s: string) {
22 32
    this.type = type
23 32
    this.s = s
24
  }
25
26
  /**
27
   * The text representation.
28
   */
29
  toString(): string {
30 1
    return `${this.type}(${this.s})`
31
  }
32
}
33
34
export default Token
35